﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace View
{
    public partial class View : Form
    {
        
        public View()
        {
            InitializeComponent();

            
        }

        private void View_Load(object sender, EventArgs e)
        {
            
            
        }

        private void atmExit_Click(object sender, EventArgs e)
        {
            /*
            StreamWriter sw = new StreamWriter("amount.txt");
            sw.WriteLine(1500);
             */
            this.Close();
        }
        /// <summary>
        /// Go to TakeCash.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void takeCash_Click(object sender, EventArgs e)
        {
            takeCash takeCash1 = new takeCash();
            this.Visible = false;
            if (takeCash1.ShowDialog() == DialogResult.Cancel)
            {
                this.Visible = true;
            }
        }
        /// <summary>
        /// ATM Checkpoint control.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void atmInput_Click(object sender, EventArgs e)
        {
            string cardNumber;
            string pinCode;
            cardNumber = tbCard.Text;
            pinCode = tbPin.Text;
            Model model = new Model(cardNumber, pinCode);



            if (model.login(tbCard.Text, tbPin.Text) == false)
            {
                MessageBox.Show("Wrong PIN-code or cardnumber!");
            }
            else
            {
                this.takeCash.Visible = true;
                this.getBalance.Visible = true;
                this.bUpload.Visible = true;

            }
        }
        /// <summary>
        /// Go to GetBalance form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void getBalance_Click(object sender, EventArgs e)
        {
            getBalance getBalance1 = new getBalance();
            this.Visible = false;
            if (getBalance1.ShowDialog() == DialogResult.Cancel)
            {
                this.Visible = true;
            }

        }

        private void tbUpload_Click(object sender, EventArgs e)
        {
            cashUpload cashUpload1 = new cashUpload();
            this.Visible = false;
            if (cashUpload1.ShowDialog() == DialogResult.Cancel)
            {
                this.Visible = true;
            }
        }
    }
}
